package br.com.lazyprogrammer.worldsoccermanager.util;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import br.com.lazyprogrammer.worldsoccermanager.network.model.Team;
import br.com.lazyprogrammer.worldsoccermanager.network.model.User;
import br.com.lazyprogrammer.worldsoccermanager.network.task.ImageDownloaderTask;
import br.com.lazyprogrammer.worldsoccermanager.preferences.Preferences;

/**
 * Created by Andre on 29/08/2014.
 */
public class PoolData {

    public static Preferences mPref;
    public static Team team;
    public static User user;

    public static Executor POOL_EXECUTOR;

    public static ImageDownloaderTask downloader;

    public static void start() {
        int corePoolSize = 60;
        int maximumPoolSize = 80;
        int keepAliveTime = 10;

        BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(
                maximumPoolSize);
        POOL_EXECUTOR = new ThreadPoolExecutor(corePoolSize, maximumPoolSize,
                keepAliveTime, TimeUnit.SECONDS, workQueue);

        downloader = new ImageDownloaderTask();
    }

}
